//
//  FHTabBarController.m
//  心理FM
//
//  Created by lanou3g on 15/7/15.
//  Copyright (c) 2015年 WFH. All rights reserved.
//

#import "FHTabBarController.h"
#import "UIImage+FH.h"
#import "FHHomeViewController.h"
#import "SFSetTableViewController.h"
#import "XBFindTableViewController.h"

@interface FHTabBarController ()

@end

@implementation FHTabBarController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.tabBar.barTintColor=[UIColor blackColor];
    [self setUpAllChildViewController];
    
}

- (void)setUpAllChildViewController{
    
    FHHomeViewController *home=[[FHHomeViewController alloc]init];
    UINavigationController *homeVC=[[UINavigationController alloc]initWithRootViewController:home];
    [self setUpOneChildViewController:homeVC andTitle:@"首页" andImage:[UIImage imageNamed:@"shouyeXiong1"] andselImage:[UIImage imageWithOriginalName:@"shouyeSelectedXiong1"]];
    self.navigationController.navigationBar.tintColor = [UIColor clearColor];
    
    XBFindTableViewController *faxian=[[XBFindTableViewController alloc]init];
    UINavigationController *faxianVC=[[UINavigationController alloc]initWithRootViewController:faxian];
    [self setUpOneChildViewController:faxianVC andTitle:@"发现" andImage:[UIImage imageNamed:@"faxianXiong1"] andselImage:[UIImage imageWithOriginalName:@"faxianSelectedXiong1"]];
    
    
    SFSetTableViewController *shezhi=[[SFSetTableViewController alloc]init];
    UINavigationController *shezhiVC=[[UINavigationController alloc]initWithRootViewController:shezhi];
    [self setUpOneChildViewController:shezhiVC andTitle:@"设置" andImage:[UIImage imageNamed:@"shezhiXiong1"] andselImage:[UIImage imageWithOriginalName:@"shezhiSelectedXiong1"]];
}
- (void)setUpOneChildViewController:(UIViewController *)vc andTitle:(NSString *)title andImage:(UIImage *)image andselImage:(UIImage *)selImage{
    vc.tabBarItem.title=title;
    vc.tabBarItem.image=image;
    NSMutableDictionary *dic=[NSMutableDictionary dictionary];
    [dic setObject:[UIColor whiteColor] forKey:NSForegroundColorAttributeName];
    [vc.tabBarItem setTitleTextAttributes:dic forState:UIControlStateSelected];
    vc.tabBarItem.selectedImage=selImage;
    [self addChildViewController:vc];
}
@end
